<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.10.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>common_util: src/common_util/fileutil.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectalign">
   <div id="projectname">common_util
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.10.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(0); });
/* @license-end */
</script>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_2961cad218251a7c35c6867350b80887.html">common_util</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle"><div class="title">fileutil.h</div></div>
</div><!--header-->
<div class="contents">
<a href="fileutil_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno">    1</span> </div>
<div class="line"><a id="l00019" name="l00019"></a><span class="lineno">   19</span><span class="preprocessor">#pragma once</span></div>
<div class="line"><a id="l00020" name="l00020"></a><span class="lineno">   20</span> </div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno">   21</span><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno">   22</span><span class="preprocessor">#include &lt;cstdio&gt;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno">   23</span><span class="preprocessor">#include &quot;<a class="code" href="filetype_8h.html">filetype.h</a>&quot;</span></div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno">   24</span><span class="preprocessor">#include &quot;<a class="code" href="filepath_8h.html">filepath.h</a>&quot;</span></div>
<div class="line"><a id="l00025" name="l00025"></a><span class="lineno">   25</span> </div>
<div class="line"><a id="l00026" name="l00026"></a><span class="lineno">   26</span><span class="keyword">namespace </span>cutl</div>
<div class="line"><a id="l00027" name="l00027"></a><span class="lineno">   27</span>{</div>
<div class="line"><a id="l00028" name="l00028"></a><span class="lineno">   28</span> </div>
<div class="foldopen" id="foldopen00033" data-start="{" data-end="};">
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="classcutl_1_1file__guard.html">   33</a></span>    <span class="keyword">class </span><a class="code hl_class" href="classcutl_1_1file__guard.html">file_guard</a></div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno">   34</span>    {</div>
<div class="line"><a id="l00035" name="l00035"></a><span class="lineno">   35</span>    <span class="keyword">public</span>:</div>
<div class="line"><a id="l00041" name="l00041"></a><span class="lineno"><a class="line" href="classcutl_1_1file__guard.html#a40ce43dcb8dc9f353f90d8161498a0f7">   41</a></span>        <span class="keyword">explicit</span> <a class="code hl_function" href="classcutl_1_1file__guard.html#a40ce43dcb8dc9f353f90d8161498a0f7">file_guard</a>(FILE *file);</div>
<div class="line"><a id="l00042" name="l00042"></a><span class="lineno">   42</span> </div>
<div class="line"><a id="l00047" name="l00047"></a><span class="lineno"><a class="line" href="classcutl_1_1file__guard.html#af475b95069dbbdd9fae27d3e5aad734d">   47</a></span>        <a class="code hl_function" href="classcutl_1_1file__guard.html#af475b95069dbbdd9fae27d3e5aad734d">~file_guard</a>();</div>
<div class="line"><a id="l00048" name="l00048"></a><span class="lineno">   48</span> </div>
<div class="line"><a id="l00054" name="l00054"></a><span class="lineno"><a class="line" href="classcutl_1_1file__guard.html#aa2dae82b780807b217c42854e50ac9a8">   54</a></span>        FILE *<a class="code hl_function" href="classcutl_1_1file__guard.html#aa2dae82b780807b217c42854e50ac9a8">getfd</a>() <span class="keyword">const</span>;</div>
<div class="line"><a id="l00055" name="l00055"></a><span class="lineno">   55</span> </div>
<div class="line"><a id="l00056" name="l00056"></a><span class="lineno">   56</span>    <span class="keyword">private</span>:</div>
<div class="line"><a id="l00057" name="l00057"></a><span class="lineno">   57</span>        FILE *file_;</div>
<div class="line"><a id="l00058" name="l00058"></a><span class="lineno">   58</span>    };</div>
</div>
<div class="line"><a id="l00059" name="l00059"></a><span class="lineno">   59</span> </div>
<div class="line"><a id="l00066" name="l00066"></a><span class="lineno"><a class="line" href="fileutil_8h.html#ab248798acf21f8ce5735738f0882a91b">   66</a></span>    std::string <a class="code hl_function" href="fileutil_8h.html#ab248798acf21f8ce5735738f0882a91b">filetype_flag</a>(<a class="code hl_enumeration" href="filetype_8h.html#a9d3ee53b2774c37cc5a17766507de28c">filetype</a> type);</div>
<div class="line"><a id="l00067" name="l00067"></a><span class="lineno">   67</span> </div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"><a class="line" href="fileutil_8h.html#a1e27df14bf44381e7e0a20e4c573d4f5">   74</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#a1e27df14bf44381e7e0a20e4c573d4f5">createfile</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;path);</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno">   75</span> </div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"><a class="line" href="fileutil_8h.html#a08d521298f87d3470d3163928d3cb1f1">   83</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#a08d521298f87d3470d3163928d3cb1f1">createlink</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;referenece, <span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;<a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a>);</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno">   84</span> </div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno">   85</span>    <span class="comment">// recursive: create parent directories if not exist, like the &#39;mkdir -p&#39; command</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"><a class="line" href="fileutil_8h.html#add3d8ef4215ce8d54c9dbe18dd35c82b">   94</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#add3d8ef4215ce8d54c9dbe18dd35c82b">createdir</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;path, <span class="keywordtype">bool</span> recursive = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno">   95</span> </div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"><a class="line" href="fileutil_8h.html#ab5971fce037518ec1d89532511e84cdf">  102</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#ab5971fce037518ec1d89532511e84cdf">removefile</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;path);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno">  103</span> </div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"><a class="line" href="fileutil_8h.html#a59de688713570479a87f534309f7ec6a">  112</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#a59de688713570479a87f534309f7ec6a">removedir</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;path, <span class="keywordtype">bool</span> recursive = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno">  113</span> </div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"><a class="line" href="fileutil_8h.html#a27c4f2c12172b95c3f64090e431e0393">  124</a></span>    std::string <a class="code hl_function" href="fileutil_8h.html#a27c4f2c12172b95c3f64090e431e0393">readtext</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;path, uint64_t max_read_size = 4096);</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno">  125</span> </div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"><a class="line" href="fileutil_8h.html#afce142cfc976c83b8236dfdb2edec314">  133</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#afce142cfc976c83b8236dfdb2edec314">writetext</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;path, <span class="keyword">const</span> std::string &amp;content);</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno">  134</span> </div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"><a class="line" href="fileutil_8h.html#ae0b32140037ee8ad3eed3f916aca6121">  147</a></span>    uint64_t <a class="code hl_function" href="fileutil_8h.html#ae0b32140037ee8ad3eed3f916aca6121">filesize</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;<a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a>, <span class="keywordtype">bool</span> link_target = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno">  148</span> </div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"><a class="line" href="fileutil_8h.html#add5974dfd24e73d6ea0384d986e03291">  155</a></span>    uint64_t <a class="code hl_function" href="fileutil_8h.html#add5974dfd24e73d6ea0384d986e03291">dirsize</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;dirpath);</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno">  156</span> </div>
<div class="line"><a id="l00166" name="l00166"></a><span class="lineno"><a class="line" href="fileutil_8h.html#aa4f744aa8a74118855fab1240f556c50">  166</a></span>    <a class="code hl_typedef" href="filetype_8h.html#a8827b47b58e5d520b41cb950d8fdea7c">filevec</a> <a class="code hl_function" href="fileutil_8h.html#aa4f744aa8a74118855fab1240f556c50">list_files</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;dirpath, <a class="code hl_enumeration" href="filetype_8h.html#a9d3ee53b2774c37cc5a17766507de28c">filetype</a> type = filetype::all, <span class="keywordtype">bool</span> recursive = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00167" name="l00167"></a><span class="lineno">  167</span> </div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"><a class="line" href="fileutil_8h.html#a0f3ffa92b4eaffde5de4c0393bf662d3">  177</a></span>    <a class="code hl_typedef" href="filetype_8h.html#a8827b47b58e5d520b41cb950d8fdea7c">filevec</a> <a class="code hl_function" href="fileutil_8h.html#a0f3ffa92b4eaffde5de4c0393bf662d3">find_files</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;dirpath, <span class="keyword">const</span> std::string &amp;name, <span class="keywordtype">bool</span> recursive = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno">  178</span> </div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"><a class="line" href="fileutil_8h.html#aa4aa18393e23d0022051e5ee9f5e4ff6">  188</a></span>    <a class="code hl_typedef" href="filetype_8h.html#a8827b47b58e5d520b41cb950d8fdea7c">filevec</a> <a class="code hl_function" href="fileutil_8h.html#aa4aa18393e23d0022051e5ee9f5e4ff6">find_files_by_extension</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;dirpath, <span class="keyword">const</span> std::string &amp;extension, <span class="keywordtype">bool</span> recursive = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno">  189</span> </div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"><a class="line" href="fileutil_8h.html#a001077c7cc1071c8871ca7b338face04">  201</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#a001077c7cc1071c8871ca7b338face04">copyfile</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;srcpath, <span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;dstpath, <span class="keywordtype">bool</span> attributes = <span class="keyword">false</span>);</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno">  202</span> </div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno">  203</span>    <span class="comment">// copy directory recursively</span></div>
<div class="line"><a id="l00212" name="l00212"></a><span class="lineno"><a class="line" href="fileutil_8h.html#afa2d5fd4752b0b76ffcf5b3307800a9c">  212</a></span>    <span class="keywordtype">bool</span> <a class="code hl_function" href="fileutil_8h.html#afa2d5fd4752b0b76ffcf5b3307800a9c">copydir</a>(<span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;srcdir, <span class="keyword">const</span> <a class="code hl_class" href="classcutl_1_1filepath.html">filepath</a> &amp;dstdir);</div>
<div class="line"><a id="l00213" name="l00213"></a><span class="lineno">  213</span> </div>
<div class="line"><a id="l00214" name="l00214"></a><span class="lineno">  214</span>} <span class="comment">// namespace cutl</span></div>
<div class="ttc" id="aclasscutl_1_1file__guard_html"><div class="ttname"><a href="classcutl_1_1file__guard.html">cutl::file_guard</a></div><div class="ttdoc">The file guard class to manage the FILE pointer automatically. file_guard object can close the FILE p...</div><div class="ttdef"><b>Definition</b> fileutil.h:34</div></div>
<div class="ttc" id="aclasscutl_1_1file__guard_html_a40ce43dcb8dc9f353f90d8161498a0f7"><div class="ttname"><a href="classcutl_1_1file__guard.html#a40ce43dcb8dc9f353f90d8161498a0f7">cutl::file_guard::file_guard</a></div><div class="ttdeci">file_guard(FILE *file)</div><div class="ttdoc">Construct a new file guard object.</div></div>
<div class="ttc" id="aclasscutl_1_1file__guard_html_aa2dae82b780807b217c42854e50ac9a8"><div class="ttname"><a href="classcutl_1_1file__guard.html#aa2dae82b780807b217c42854e50ac9a8">cutl::file_guard::getfd</a></div><div class="ttdeci">FILE * getfd() const</div><div class="ttdoc">Get the FILE pointer.</div></div>
<div class="ttc" id="aclasscutl_1_1file__guard_html_af475b95069dbbdd9fae27d3e5aad734d"><div class="ttname"><a href="classcutl_1_1file__guard.html#af475b95069dbbdd9fae27d3e5aad734d">cutl::file_guard::~file_guard</a></div><div class="ttdeci">~file_guard()</div><div class="ttdoc">Destroy the file guard object.</div></div>
<div class="ttc" id="aclasscutl_1_1filepath_html"><div class="ttname"><a href="classcutl_1_1filepath.html">cutl::filepath</a></div><div class="ttdoc">The class for file path operations.</div><div class="ttdef"><b>Definition</b> filepath.h:34</div></div>
<div class="ttc" id="afilepath_8h_html"><div class="ttname"><a href="filepath_8h.html">filepath.h</a></div><div class="ttdoc">The class for file path operations.</div></div>
<div class="ttc" id="afiletype_8h_html"><div class="ttname"><a href="filetype_8h.html">filetype.h</a></div><div class="ttdoc">Define the structs about fileutil, such as filetype and file_entity.</div></div>
<div class="ttc" id="afiletype_8h_html_a8827b47b58e5d520b41cb950d8fdea7c"><div class="ttname"><a href="filetype_8h.html#a8827b47b58e5d520b41cb950d8fdea7c">cutl::filevec</a></div><div class="ttdeci">std::vector&lt; file_entity &gt; filevec</div><div class="ttdoc">The vector of file_entity.</div><div class="ttdef"><b>Definition</b> filetype.h:75</div></div>
<div class="ttc" id="afiletype_8h_html_a9d3ee53b2774c37cc5a17766507de28c"><div class="ttname"><a href="filetype_8h.html#a9d3ee53b2774c37cc5a17766507de28c">cutl::filetype</a></div><div class="ttdeci">filetype</div><div class="ttdoc">The type of file.</div><div class="ttdef"><b>Definition</b> filetype.h:38</div></div>
<div class="ttc" id="afileutil_8h_html_a001077c7cc1071c8871ca7b338face04"><div class="ttname"><a href="fileutil_8h.html#a001077c7cc1071c8871ca7b338face04">cutl::copyfile</a></div><div class="ttdeci">bool copyfile(const filepath &amp;srcpath, const filepath &amp;dstpath, bool attributes=false)</div><div class="ttdoc">Copy a file or symbolic link(shortcut on windows).</div></div>
<div class="ttc" id="afileutil_8h_html_a08d521298f87d3470d3163928d3cb1f1"><div class="ttname"><a href="fileutil_8h.html#a08d521298f87d3470d3163928d3cb1f1">cutl::createlink</a></div><div class="ttdeci">bool createlink(const filepath &amp;referenece, const filepath &amp;filepath)</div><div class="ttdoc">Create a symbolic link or shortcut.</div></div>
<div class="ttc" id="afileutil_8h_html_a0f3ffa92b4eaffde5de4c0393bf662d3"><div class="ttname"><a href="fileutil_8h.html#a0f3ffa92b4eaffde5de4c0393bf662d3">cutl::find_files</a></div><div class="ttdeci">filevec find_files(const filepath &amp;dirpath, const std::string &amp;name, bool recursive=false)</div><div class="ttdoc">Find all files in a directory by name.</div></div>
<div class="ttc" id="afileutil_8h_html_a1e27df14bf44381e7e0a20e4c573d4f5"><div class="ttname"><a href="fileutil_8h.html#a1e27df14bf44381e7e0a20e4c573d4f5">cutl::createfile</a></div><div class="ttdeci">bool createfile(const filepath &amp;path)</div><div class="ttdoc">Create a new file.</div></div>
<div class="ttc" id="afileutil_8h_html_a27c4f2c12172b95c3f64090e431e0393"><div class="ttname"><a href="fileutil_8h.html#a27c4f2c12172b95c3f64090e431e0393">cutl::readtext</a></div><div class="ttdeci">std::string readtext(const filepath &amp;path, uint64_t max_read_size=4096)</div><div class="ttdoc">Read the text content of a file.</div></div>
<div class="ttc" id="afileutil_8h_html_a59de688713570479a87f534309f7ec6a"><div class="ttname"><a href="fileutil_8h.html#a59de688713570479a87f534309f7ec6a">cutl::removedir</a></div><div class="ttdeci">bool removedir(const filepath &amp;path, bool recursive=false)</div><div class="ttdoc">Remove a directory.</div></div>
<div class="ttc" id="afileutil_8h_html_aa4aa18393e23d0022051e5ee9f5e4ff6"><div class="ttname"><a href="fileutil_8h.html#aa4aa18393e23d0022051e5ee9f5e4ff6">cutl::find_files_by_extension</a></div><div class="ttdeci">filevec find_files_by_extension(const filepath &amp;dirpath, const std::string &amp;extension, bool recursive=false)</div><div class="ttdoc">Find all files in a directory by extension.</div></div>
<div class="ttc" id="afileutil_8h_html_aa4f744aa8a74118855fab1240f556c50"><div class="ttname"><a href="fileutil_8h.html#aa4f744aa8a74118855fab1240f556c50">cutl::list_files</a></div><div class="ttdeci">filevec list_files(const filepath &amp;dirpath, filetype type=filetype::all, bool recursive=false)</div><div class="ttdoc">List all files in a directory.</div></div>
<div class="ttc" id="afileutil_8h_html_ab248798acf21f8ce5735738f0882a91b"><div class="ttname"><a href="fileutil_8h.html#ab248798acf21f8ce5735738f0882a91b">cutl::filetype_flag</a></div><div class="ttdeci">std::string filetype_flag(filetype type)</div><div class="ttdoc">Get the file type flag string.</div></div>
<div class="ttc" id="afileutil_8h_html_ab5971fce037518ec1d89532511e84cdf"><div class="ttname"><a href="fileutil_8h.html#ab5971fce037518ec1d89532511e84cdf">cutl::removefile</a></div><div class="ttdeci">bool removefile(const filepath &amp;path)</div><div class="ttdoc">Remove a regular file or symbolic link(shortcut on windows).</div></div>
<div class="ttc" id="afileutil_8h_html_add3d8ef4215ce8d54c9dbe18dd35c82b"><div class="ttname"><a href="fileutil_8h.html#add3d8ef4215ce8d54c9dbe18dd35c82b">cutl::createdir</a></div><div class="ttdeci">bool createdir(const filepath &amp;path, bool recursive=false)</div><div class="ttdoc">Create a new directory.</div></div>
<div class="ttc" id="afileutil_8h_html_add5974dfd24e73d6ea0384d986e03291"><div class="ttname"><a href="fileutil_8h.html#add5974dfd24e73d6ea0384d986e03291">cutl::dirsize</a></div><div class="ttdeci">uint64_t dirsize(const filepath &amp;dirpath)</div><div class="ttdoc">Get the size of a directory, include all files and subdirectories.</div></div>
<div class="ttc" id="afileutil_8h_html_ae0b32140037ee8ad3eed3f916aca6121"><div class="ttname"><a href="fileutil_8h.html#ae0b32140037ee8ad3eed3f916aca6121">cutl::filesize</a></div><div class="ttdeci">uint64_t filesize(const filepath &amp;filepath, bool link_target=false)</div><div class="ttdoc">Get the size of a file.</div></div>
<div class="ttc" id="afileutil_8h_html_afa2d5fd4752b0b76ffcf5b3307800a9c"><div class="ttname"><a href="fileutil_8h.html#afa2d5fd4752b0b76ffcf5b3307800a9c">cutl::copydir</a></div><div class="ttdeci">bool copydir(const filepath &amp;srcdir, const filepath &amp;dstdir)</div><div class="ttdoc">Copy a directory recursively.</div></div>
<div class="ttc" id="afileutil_8h_html_afce142cfc976c83b8236dfdb2edec314"><div class="ttname"><a href="fileutil_8h.html#afce142cfc976c83b8236dfdb2edec314">cutl::writetext</a></div><div class="ttdeci">bool writetext(const filepath &amp;path, const std::string &amp;content)</div><div class="ttdoc">Write the text content to a file.</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0
</small></address>
</body>
</html>
